Skip to content

build: add min release age step - #8164

Merged
tomdavies73 merged 2 commits into
masterfrom
add_min_release_age_build_step
Sep 10, 2026
Merged

build: add min release age step#8164
tomdavies73 merged 2 commits into
masterfrom
add_min_release_age_build_step

Conversation

@tomdavies73

@tomdavies73 tomdavies73 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Proposed behaviour

Adds a build step which will alert us if any packages do not meet our minimum release age. This is particularly useful for dependabot raised PRs as there is currently no way to get dependabot to respect our minumum release age.

This prevents us from accidentially adding recently published packages which are comporomised via dependabot.

Here's a link to a run that shows the new check succesully failing on a recently published package

Here's a link to a run that shows the new check sucessfully failing after the above package met maturity guidelines

Also added a unit test for regression security

Screenshot 2026-09-10 at 10 47 12

Current behaviour

Currently dependabot does not adhere to our minimum release age during security alerts, therefore if we do not verify the package maturity we could accept package updates which are not aligned with our maturity guidelines.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

@tomdavies73 tomdavies73 self-assigned this Sep 3, 2026
@tomdavies73 tomdavies73 added the Work in progress This is a WIP PR so may not be ready for review label Sep 3, 2026
@tomdavies73
tomdavies73 requested a balanced review from Copilot September 3, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The threshold unit is incorrect, and dependency code can execute in parallel jobs before validation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds CI enforcement for minimum npm package release age.

Changes:

  • Adds concurrent registry checks for locked package versions.
  • Exposes the checker through npm.
  • Runs the check before the build job installs dependencies.
File summaries
File Description
scripts/check-release-age.mjs Implements release-age validation.
package.json Adds the validation command.
.github/workflows/ci.yml Integrates validation into CI.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/ci.yml
Comment on lines +152 to +155
- name: Check release age
run: npm run check-release-age
env:
MIN_RELEASE_AGE: ${{ steps.age.outputs.min-release-age }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure there is a real risk here, our checks are ran in an isolated enviroment so its not the end of the world if we do an npm install elsewhere here.

I think all that really matters is that we throw an exit code 1 and the build fails so we can't merge the PR 👍

});

const now = Date.now();
const minimumAgeInMilliseconds = minReleaseAge * MILLISECONDS_IN_DAY;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min-release-age=3 will be counted as 3 days, not sure where its getting 3 seconds from. What we have here works as expected

Comment thread scripts/check-release-age.mjs Outdated
Comment on lines +86 to +88
const response = await fetch(getPackageUrl(registry, packageName), {
headers: { Accept: "application/json" },
});
@tomdavies73
tomdavies73 force-pushed the add_min_release_age_build_step branch from 4549819 to 86e36aa Compare September 8, 2026 13:18
@tomdavies73 tomdavies73 added Pending Review No QA Required No UX QA Required and removed Work in progress This is a WIP PR so may not be ready for review labels Sep 8, 2026
nineteen88
nineteen88 previously approved these changes Sep 8, 2026

const now = Date.now();
const minimumAgeInMilliseconds = minReleaseAge * MILLISECONDS_IN_DAY;
const tooNewPackages = lockedPackages

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const tooNewPackages = lockedPackages
const immaturePackages = lockedPackages

non-blocking just might be more intuitive to non-native English speakers etc

@edleeks87 edleeks87 Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: is there anything we can do testing wise here? We'd essentially be assuming this works going forward and potentially not realise if it ever broke for a while so some form of test might act as an early guard against it. Feel free to ping me to chat on slack about this if you want

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good shout

@tomdavies73
tomdavies73 force-pushed the add_min_release_age_build_step branch 2 times, most recently from 0c357c3 to a93a799 Compare September 10, 2026 09:55
@tomdavies73
tomdavies73 force-pushed the add_min_release_age_build_step branch from a93a799 to 6c86bf5 Compare September 10, 2026 12:00
@tomdavies73
tomdavies73 marked this pull request as ready for review September 10, 2026 12:06
@tomdavies73
tomdavies73 requested review from a team as code owners September 10, 2026 12:06
@tomdavies73
tomdavies73 merged commit 02813b8 into master Sep 10, 2026
40 of 41 checks passed
@tomdavies73
tomdavies73 deleted the add_min_release_age_build_step branch September 10, 2026 12:28
@carbonci

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 161.25.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants